<template>
  <el-header>
    <!-- <el-select v-model="keyword" clearable placeholder="请选择">
      <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="item.value"
        @click.native="search(item)"
      >
      </el-option>
    </el-select> -->
    <!-- <el-col>
      <el-input
       v-model="keyword"
        type="text"
        placeholder="请输入查询名词"
        clearable
      >
        <el-button
          @click="sear"
          slot="append"
          icon="el-icon-search"
        ></el-button>
      </el-input>
    </el-col> -->
    <el-button @click="outLogin">退出</el-button>
  </el-header>
</template>

<script>
export default {
  data() {
    return {
      keyword: "",

      options: [
        {
          value: "工资",
          label: "工资",
        },
        {
          value: "公告",
          label: "公告",
        },
        {
          value: "会议",
          label: "会议",
        },
        {
          value: "迟到",
          label: "迟到",
        },
        {
          value: "请假",
          label: "请假",
        },
        {
          value: "报销",
          label: "报销",
        },
        {
          value: "早退",
          label: "早退",
        },
        {
          value: "审批",
          label: "审批",
        },
        {
          value: "部门",
          label: "部门",
        },
         {
          value: "用户",
          label: "用户",
        },
        

      ],
      searchto: [],
    };
  },
   created() {
    //  this.search();
  },
  methods: {
    outLogin() {
      this.$http.post("/logout").then((res) => {
        console.log(res);
        this.$message.success("退出成功!");
      });
      //删除token值
      window.sessionStorage.clear();
      // //跳转到登录页
      this.$router.push("/login");
    },
    search() {
      this.$http
        .get("/search", { params: { keyword: this.keyword } })
        .then((res) => {
          console.log(res);
          this.searchto = res.data.data;
          console.log(this.searchto);

        //跳转路由
          this.$router.push({
            path: "/search",
            query:{name:JSON.stringify(this.searchto)},
          });

        });
    },
  },
};
</script>

<style scoped>
.el-header {
  float: right;
  /* 两边贴边对齐 */
  /* justify-content: space-between; */
  /* 弹性布局 */
  display: flex;
  /* 居中对齐 */
  align-items: center;
}
</style>
